<?php 
/**
 * 封装性  魔术方法
 * __get()
 * __set()
 *
 * __isset() 在使用isset()判断一个私有属性是否存在时，自动调用
 * __unset()
 * 
 */

	/**
	* 创建一个人类
	*/
	class Person {
		private $name;
		private $age;
		private $sex;
		private $height;
		private $width;

		function __construct($name="张三", $age=20, $sex="男", $height=100, $width=100)
		{
			# code...
			$this->name = $name;
			$this->age = $age;
			$this->sex = $sex;
			$this->height = $height;
			$this->width  = $width;

		}

		function __isset($proname){
			echo "{$proname}--------------";
			if($proname=="age"){
				return false;
			}
			return isset($this->$proname);
		}

		function __destruct(){
			echo "再见".$this->name."<br>";
		}
	}

	$P1 = new Person("Tom", 20, "男");



 ?>